import http from "@/utils/request";
import type { AddFriend } from "@/pages/Friendship/AddFriendModal";

export async function friendshipList(name?: string) {
    return http('/user/friendship', 'get', { name: name || '' });
}

export async function addFriend(data: AddFriend) {
    return await http('/friendship/add', 'post', data);
}

export async function findChatroom(userId1: number, userId2: number) {
    return await http('/chatroom/findChatroom', 'get', {
        userId1, userId2
    });
}

export async function createOneToOne(friendId: number) {
    return await http('/chatroom/create-one2one', 'get', {
        friendId
    });
}